import java.util.ArrayList;
import java.util.Scanner;

public class Tesdemo2 {
    public ListNode FindKthToTail(ListNode head,int k){
        if(k<0||head==null){
            return null;
        }
        ListNode fast=head;
        ListNode slow=head;
        while(k-1<0){
            fast=fast.next;
            if(fast==null){
                return null;
            }k--;
        }
        while(fast.next!=null){
            fast=fast.next;
            slow=slow.next;
        }return slow;
    }
    public ListNode middleNode(ListNode head) {
        ListNode fast=head;
        ListNode slow=head;
        while(fast!=null&&fast.next!=null){//fast.next!=null不能放前面，会空指针异常。
            fast=fast.next.next;
            slow=slow.next;
        }return slow;
    }
    //反转一个单链表
    public ListNode reverselist(ListNode head){
        if(head==null){
            return null;
        }ListNode prev=null;
        ListNode cur=head;
        while(cur!=null){
            ListNode curNext=cur.next;
            cur.next=prev;
            prev=cur;
            cur=curNext;
        }return prev;
    }
    //给你一个链表的头节点 head 和一个整数 val ，请你删除链表中所有满足 Node.val == val 的节点，并返回 新的头节点 。
    public ListNode removeElements(ListNode head,int val){
        if(head==null){
            return null;
        }
        ListNode cur=head.next;
        ListNode prev=head;
        while(cur!=null){
            if(cur.val==val){
                cur=cur.next;
                prev.next=cur;
            }else{
                prev=cur;
                cur=cur.next;
            }
        }if(head.val==val){
            head=head.next;
        }return head;
    }

   /* public static ListNode mergeTwoList(ListNode headA,ListNode headB){
        ListNode newHead=new ListNode(-1);
        ListNode tem=newHead;
        while(headA!=null&&headB!=null){
            if(headA.val<headB.val){
                tem.next=headA;
                headA=headA.next;
                tem=tem.next;
            }else{


            }
        }
    }*/
    public static void  main3(String[] args) {
        String str="hello word";
        String str2="owh";
        ArrayList<Character>list=new ArrayList<>();
        for(int i=0;i<str.length();i++){
            char ch=str.charAt(i);
            if(!str2.contains(ch+"")){
                list.add(ch);
            }
        }
        for (char ch:list) {
            System.out.print(ch);
        }
    }
    public static String func1(String str) {
        StringBuilder sb = new StringBuilder();
        int[] array = new int[58];//定义一个空的数组
        for (int i = 0;i<str.length(); i++){
            char ch=str.charAt(i);
            if(array[ch-65]==0){
                sb.append(ch);
                array[ch-65]=1;
        }
    }return sb.toString();
    }
    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNextLine()) {
            String str=scanner.nextLine();
            String ret=func1(str);
            System.out.println(ret);
        }
    }


    public static String func(String str) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < str.length(); i++) {
            char ch = str.charAt(i);
            if (!sb.toString().contains(ch + "")) {
                sb.append(ch);
            }
        }
        return sb.toString();
    }

    public static void main2(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNextLine()) {
            String str = scanner.nextLine();
            String ret = func(str);
            System.out.println(ret);
        }
    }
}
     /*   public static void main2(String[] args) {
            MyArrayList <Book>books=new MyArrayList<Book>();
            books.add(new Book());
            books.add(new Person());
        }
    }*/



